var express = require('express');
var router = express.Router();
var getchar = require('../public/getCharList');
var url = 'http://www.51sfzd.com/CharCollectionSystem/index.php/Index/get_pic_list?strs=';

/* GET home page. */
router.use('/', function (req, res) {
    var strs = req.param('strs');

    if (strs == undefined || strs == null || strs.length <= 0) {
        var result = {
            status: 0,
            data: null,
            info: '请正确文字'
        };
        res.send(result);
    }
    else {
 
        //这里一定要进行中文URL编码，不然请求出错
        getchar(url + encodeURI(strs), function (result) {
            res.send(result);
        });
    }
})

module.exports = router;
